<?php
/**
 *APINAME:
 *Developer:
 *Complete:
 */

namespace app\middleware;

use app\common\controller\Basecontroller;
use think\facade\Cache;

class NullToken extends Basecontroller
{
    public function handle($request, \Closure $next){
        $tokenName = $request->header('Authorization');
        if ($tokenName != "" && !Cache::get($tokenName)){
            return $this->returnJson(self::ERROR,'请携带默认token来请求接口');
        }
        return $next($request);
    }
}